package com.dayilyword.service.impl;

import com.dayilyword.entity.Attention;
import com.dayilyword.entity.Msg;
import com.dayilyword.mapper.AttentionMapper;
import com.dayilyword.mapper.MsgMapper;
import com.dayilyword.service.AttentionService;
import com.dayilyword.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class AttentionServiceImpl implements AttentionService {
    @Autowired
    AttentionMapper attentionMapper;

    @Override
    public void attention(int userId, int targetUserId) {
        Attention attention = new Attention();
        attention.setUserId(userId);
        attention.setTargetId(targetUserId);
        attentionMapper.insertSelective(attention);
    }

    @Override
    public void disableMsgAttention(int userId, int targetUserId) {
        attentionMapper.deleteByUserIdAndTargetId(userId, targetUserId);
    }

    @Override
    public List<HashMap<String, Object>> getAttentionList(int userId) {
        return attentionMapper.getAttentionList(userId);
    }
    @Override
    public List<HashMap<String, Object>> getFansList(int userId) {
        return attentionMapper.getFansList(userId);
    }
}
